import * as lodash from "lodash-es";

export class CommonUtil {

	public static isAndroid(): boolean {
		let u = navigator.userAgent;
		let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
		return isAndroid;
	}

	public static isIOS(): boolean {
		let u = navigator.userAgent;
		let isIOS = /(iPhone|iPad|iPod|iOS)/i.test(u);
		return isIOS;
	}

	public static isSafari(): boolean {
		let u = navigator.userAgent;
		let isSafari = /Safari/.test(u) && !/Chrome/.test(u);
		return isSafari;
	}

	/** 深拷贝 */
	public static cloneDeep<T>(data: any): T {
		return lodash.cloneDeep(data);
	}

}
